<?php
/**
 * Created by JetBrains PhpStorm.
 * User: MeRo
 * Date: 14.09.13
 * Time: 19:32
 * To change this template use File | Settings | File Templates.
 */

function print_arr($arr = '') {
    printArr($arr);
}

function printArr($arr = '') {
    if (is_array($arr) === true) {
        echo '<pre>';
        print_r($arr);
        echo '</pre>';
    } else {
        echo '<br />';
        var_dump($arr);
        echo '<br />';
    }
}

function getRandomColor($bracket = true, $donts = array()) {
    $colors = array(
        'E72E2E', //Rot
        '850303', //Weinrot
        '780385', //Lila
        '0A119A', //Blau
        '6D74F7', //Hellblau
        '158CB8', //Tuerkis
        '14BA1F', //Gruen
        'DD8200', //Orange
        '684C2A'  //Braun
    );

    $dontsRevised = array();
    foreach ($donts as $dont) {
        $dontsRevised[] = str_replace('#', '', $dont);
    }

    $colors = array_merge(array_diff($colors, $dontsRevised));
    $pos    = (int) round(rand(0, count($colors) - 1));

    return ($bracket === true ? '#' : '') . $colors[$pos];
}

function get($name) {
    return isset($_GET[$name]) === true ? mysql_real_escape_string($_GET[$name]) : NULL;
}

function post($name) {
    return isset($_POST[$name]) === true ? mysql_real_escape_string($_POST[$name]) : NULL;
}

class renderElement
{
    protected $_echo = '';

    protected $_contao = NULL;

    protected function _addElement($element) {
        $this->_echo .= '
        ' . $element;

        return $this;
    }

    protected function _render() {
        echo $this->_echo;

        return $this;
    }
}